SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE VIEW [dbo].[vwlServiciosAgentes]
AS
SELECT     dbo.tb_ServiciosAgentes.idServicioAgente AS ID, dbo.tb_ServiciosAgentes.Agente, dbo.tb_Organizaciones.CUISE AS CUE, 
                      dbo.tb_Organizaciones.Nombre AS Institución, dbo.tb_ServiciosAgentes.FechaAlta, dbo.tb_ServiciosAgentes.FechaBaja, 
                      dbo.tb_Asignaturas.Descripcion AS Asignatura, dbo.tb_ServiciosAgentes.Horas, dbo.tb_SituacionRevista.Descripcion AS SituacionRevista, 
                      dbo.tb_CargosSalariales.cargo AS Cargo, dbo.tb_Normas.Descripcion AS NormaAlta, tb_Normas_1.Descripcion AS NormaBaja
FROM         dbo.tb_ServiciosAgentes INNER JOIN
                      dbo.tb_Organizaciones ON dbo.tb_ServiciosAgentes.UbicacionOrig = dbo.tb_Organizaciones.idOrganizaciones LEFT OUTER JOIN
                      dbo.tb_Normas AS tb_Normas_1 ON dbo.tb_ServiciosAgentes.NormaBaja = tb_Normas_1.idNorma LEFT OUTER JOIN
                      dbo.tb_Normas ON dbo.tb_ServiciosAgentes.NormaAlta = dbo.tb_Normas.idNorma LEFT OUTER JOIN
                      dbo.tb_Asignaturas ON dbo.tb_ServiciosAgentes.Asignatura = dbo.tb_Asignaturas.idAsignatura LEFT OUTER JOIN
                      dbo.tb_SituacionRevista ON dbo.tb_ServiciosAgentes.SituacionRevista = dbo.tb_SituacionRevista.idSituacionRevista LEFT OUTER JOIN
                      dbo.tb_CargosSalariales ON dbo.tb_ServiciosAgentes.CargoSalarial = dbo.tb_CargosSalariales.idCargo

GO
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [CentroDeDesignaciones]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [CertificacionesServicios]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [Direcciones De Nivel]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [MCEEjecutivo]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [PersonalDocente]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [PersonalDocenteDireccion]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [SoloVer]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [Subsidios]
GRANT SELECT ON  [dbo].[vwlServiciosAgentes] TO [SubsidiosConsulta]
GO
EXEC sp_addextendedproperty N'MS_DiagramPane1', N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "tb_ServiciosAgentes"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 125
               Right = 273
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_Organizaciones"
            Begin Extent = 
               Top = 45
               Left = 298
               Bottom = 164
               Right = 496
            End
            DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "tb_Normas_1"
            Begin Extent = 
               Top = 35
               Left = 407
               Bottom = 154
               Right = 605
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_Normas"
            Begin Extent = 
               Top = 246
               Left = 38
               Bottom = 365
               Right = 236
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_Asignaturas"
            Begin Extent = 
               Top = 366
               Left = 38
               Bottom = 485
               Right = 251
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_SituacionRevista"
            Begin Extent = 
               Top = 246
               Left = 274
               Bottom = 350
               Right = 472
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_CargosSalariales"
            Begin Extent = 
               Top = 354
               Left = 274
               Bottom = 473
               Ri', 'USER', N'dbo', 'VIEW', N'vwlServiciosAgentes', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_DiagramPane2', N'ght = 472
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 2025
         Table = 1170
         Output = 945
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
', 'USER', N'dbo', 'VIEW', N'vwlServiciosAgentes', NULL, NULL
GO
DECLARE @xp int
SELECT @xp=2
EXEC sp_addextendedproperty N'MS_DiagramPaneCount', @xp, 'USER', N'dbo', 'VIEW', N'vwlServiciosAgentes', NULL, NULL
GO
